import intelligentQuality from '@api/config/intelligent-quality-check-config'

// 获取评分基础配置
export const getBaseConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.getBaseConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
// 更新/新建 评分基础配置
export const updateBasicConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.updateBasicConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 查询评分设置
export const getScoreConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.getScoreConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 添加评分父项目
export const addScoreConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.addScoreConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 更新评分父项目
export const updateScoreConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.updateScoreConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 删除某条评分设置父项
export const removeScoreConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.removeScoreConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 添加评分设置子项
export const addSubScoreConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.addSubScoreConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 删除评分设置子项目
export const rmSubScoreConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.rmSubScoreConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 评分规则相关===============================

// 添加评分规则
export const addMarkRuleConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.addRule(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 更新评分规则
export const updateMarkRuleConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.updateRule(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 删除评分规则
export const removeMarkRuleConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.removeRule(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 查询规则列表
export const getMarkRuleListConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.getRuleList(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 查询规则详情
export const getRuleDetailConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.getRule(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}

// 开启 停用 评分规则
export const enOrDisableRuleConfig = ({ commit, state, rootState }, data) => {
  return intelligentQuality.enOrDisableRule(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
